package com.example.mylibrary.data;

import com.example.mylibrary.greendao.DaoSession;
import com.example.mylibrary.greendao.ItemGropDao;
import com.example.mylibrary.greendao.ItemRollCallDao;
import com.example.mylibrary.greendao.StudentItemDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.ToOne;


/**
 * Created by Administrator on 2017/12/11.
 * 项目检录记录表
 */
@Entity
public class ItemRollCall {

    //项目检录ID
    @Id(autoincrement = true)
    private Long itemRollCallID;

    //项目分组ID 可以没有项目分组
    private long  itemGropID;
    @ToOne(joinProperty = "itemGropID")
    private ItemGrop itemGrop;

    //学生项目ID
    @NotNull private long  studentItemID;
    @ToOne(joinProperty = "studentItemID")
    private StudentItem studentItemid;

    //项目检录图像保存路径
    private String facePath;
    //检录状态  0不通过/1通过  默认为0
    private int rollCallState;
    //检录时间
    private String  rollCalltime;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 1624488621)
    private transient ItemRollCallDao myDao;
    @Generated(hash = 672381866)
    public ItemRollCall(Long itemRollCallID, long itemGropID, long studentItemID,
            String facePath, int rollCallState, String rollCalltime) {
        this.itemRollCallID = itemRollCallID;
        this.itemGropID = itemGropID;
        this.studentItemID = studentItemID;
        this.facePath = facePath;
        this.rollCallState = rollCallState;
        this.rollCalltime = rollCalltime;
    }
    @Generated(hash = 1943961184)
    public ItemRollCall() {
    }
    public Long getItemRollCallID() {
        return this.itemRollCallID;
    }
    public void setItemRollCallID(Long itemRollCallID) {
        this.itemRollCallID = itemRollCallID;
    }
    public long getItemGropID() {
        return this.itemGropID;
    }
    public void setItemGropID(long itemGropID) {
        this.itemGropID = itemGropID;
    }
    public long getStudentItemID() {
        return this.studentItemID;
    }
    public void setStudentItemID(long studentItemID) {
        this.studentItemID = studentItemID;
    }
    public String getFacePath() {
        return this.facePath;
    }
    public void setFacePath(String facePath) {
        this.facePath = facePath;
    }
    public int getRollCallState() {
        return this.rollCallState;
    }
    public void setRollCallState(int rollCallState) {
        this.rollCallState = rollCallState;
    }
    public String getRollCalltime() {
        return this.rollCalltime;
    }
    public void setRollCalltime(String rollCalltime) {
        this.rollCalltime = rollCalltime;
    }
    @Generated(hash = 1271522950)
    private transient Long itemGrop__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1973756296)
    public ItemGrop getItemGrop() {
        long __key = this.itemGropID;
        if (itemGrop__resolvedKey == null || !itemGrop__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ItemGropDao targetDao = daoSession.getItemGropDao();
            ItemGrop itemGropNew = targetDao.load(__key);
            synchronized (this) {
                itemGrop = itemGropNew;
                itemGrop__resolvedKey = __key;
            }
        }
        return itemGrop;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 257866113)
    public void setItemGrop(@NotNull ItemGrop itemGrop) {
        if (itemGrop == null) {
            throw new DaoException(
                    "To-one property 'itemGropID' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.itemGrop = itemGrop;
            itemGropID = itemGrop.getItemGropID();
            itemGrop__resolvedKey = itemGropID;
        }
    }
    @Generated(hash = 1651737934)
    private transient Long studentItemid__resolvedKey;
    /** To-one relationship, resolved on first access. */
    @Generated(hash = 196640674)
    public StudentItem getStudentItemid() {
        long __key = this.studentItemID;
        if (studentItemid__resolvedKey == null
                || !studentItemid__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            StudentItemDao targetDao = daoSession.getStudentItemDao();
            StudentItem studentItemidNew = targetDao.load(__key);
            synchronized (this) {
                studentItemid = studentItemidNew;
                studentItemid__resolvedKey = __key;
            }
        }
        return studentItemid;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 243295573)
    public void setStudentItemid(@NotNull StudentItem studentItemid) {
        if (studentItemid == null) {
            throw new DaoException(
                    "To-one property 'studentItemID' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.studentItemid = studentItemid;
            studentItemID = studentItemid.getStudentItemID();
            studentItemid__resolvedKey = studentItemID;
        }
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 456266494)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getItemRollCallDao() : null;
    }



}

